package map;

import java.util.HashSet;
import java.util.Set;

public class Leedcode217存在重复元素 {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set = new HashSet<Integer>();
        for (int i = 0; i < nums.length; i++) {
            if(set.contains(nums[i])){//如果set包含
                return true;
            }else {
                set.add(nums[i]);
            }
        }
        return false;
    }
}
